package com.cskaoyan.mall.product.controller;

import com.cskaoyan.mall.common.result.Result;
import com.cskaoyan.mall.product.service.FileUploadService;
import io.minio.errors.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;

@RestController
@RequestMapping("admin/product")
public class AdminFileUploadController {
    @Autowired
    FileUploadService fileUploadService;
    @PostMapping("/fileUpload")
    public Result fileUpload(MultipartFile file) throws Exception {
        //下面写图片上传的逻辑
        String url = fileUploadService.uploadPic(file);
        return Result.ok(url);
    }
}
